conf: anchor function name patterns to avoid unexpected exclusions
authorFelix Krull <f_krull@gmx.de>
Wed, 26 Aug 2020 20:18:00 +0000 (22:18 +0200)
committerColin Walters <walters@verbum.org>
Fri, 6 May 2022 16:53:56 +0000 (12:53 -0400)
rust-bindings/rust/conf/ostree.toml
rust-bindings/rust/src/auto/functions.rs
rust-bindings/rust/src/auto/repo.rs
rust-bindings/rust/src/auto/versions.txt
rust-bindings/rust/sys/src/auto/versions.txt

index aeb7734ad0008f686852d91330a2c90d61903f94..a8ca3fb59e52551fdd4767c43e5f5d5465ed1d6c 100644 (file)
@@ -127,7 +127,7 @@ name = "OSTree.CollectionRef"
 status = "generate"
     [[object.function]]
     # [IGNORE] helper functions for NULL-terminated arrays
-    pattern = "dupv|freev"
+    pattern = "^(dupv|freev)$"
     ignore = true
 
     [[object.function]]
@@ -140,12 +140,12 @@ name = "OSTree.Repo"
 status = "generate"
     [[object.function]]
     # [MANUAL] we special-case the checksum value
-    pattern = "write_content|write_content_async|write_metadata|write_metadata_async"
+    pattern = "^(write_content|write_content_async|write_metadata|write_metadata_async)$"
     ignore = true
 
     [[object.function]]
     # [FAIL] these fail because of issues with arrays of dubious lifetimes
-    pattern = "find_remotes_async|pull_from_remotes_async"
+    pattern = "^(find_remotes_async|pull_from_remotes_async)$"
     ignore = true
 
     [[object.function]]
@@ -167,7 +167,7 @@ name = "OSTree.RepoFinder"
 status = "generate"
     [[object.function]]
     # [FAIL] these fail because of issues with arrays of dubious lifetimes/NULL-terminated arrays
-    pattern = "resolve_async|resolve_all_async"
+    pattern = "^(resolve_async|resolve_all_async)$"
     ignore = true
 
 [[object]]
@@ -202,7 +202,7 @@ name = "OSTree.Sign"
 status = "generate"
     [[object.function]]
     # [IGNORE] these shouldn't be on this type, they belong to subclasses
-    pattern = "dummy_.+|ed25519_.+"
+    pattern = "^(dummy_.+|ed25519_.+)$"
     ignore = true
 
 [[object]]
@@ -219,30 +219,30 @@ name = "OSTree.*"
 status = "generate"
     [[object.function]]
     # [MANUAL] probably can't be autogenerated because of the custom Checksum type
-    pattern = "checksum_file|checksum_file_async|checksum_file_at|checksum_file_from_input"
+    pattern = "^(checksum_file|checksum_file_async|checksum_file_at|checksum_file_from_input)$"
     ignore = true
 
     [[object.function]]
     # [IGNORE] low-level checksum functions, we have a custom checksum API
-    pattern = "cmp_checksum_bytes|checksum_from_bytes|checksum_to_bytes|checksum_inplace_from_bytes|checksum_inplace_to_bytes|checksum_b64_from_bytes|checksum_b64_to_bytes|checksum_b64_inplace_from_bytes|checksum_b64_inplace_to_bytes"
+    pattern = "^(cmp_checksum_bytes|checksum_from_bytes|checksum_to_bytes|checksum_inplace_from_bytes|checksum_inplace_to_bytes|checksum_b64_from_bytes|checksum_b64_to_bytes|checksum_b64_inplace_from_bytes|checksum_b64_inplace_to_bytes)$"
     ignore = true
 
     [[object.function]]
     # [IGNORE] needs custom handling to deal with its raw pointer parameter
-    pattern = "hash_object_name"
+    name = "hash_object_name"
     ignore = true
 
     [[object.function]]
     # [IGNORE] private API
-    pattern = "cmd__private__"
+    name = "cmd__private__"
     ignore = true
 
     [[object.constant]]
     # [IGNORE] version-dependent constants
-    pattern = "VERSION|VERSION_S|YEAR_VERSION|RELEASE_VERSION"
+    pattern = "^(VERSION|VERSION_S|YEAR_VERSION|RELEASE_VERSION)$"
     ignore = true
 
     [[object.constant]]
     # [IGNORE] build-dependent constants
-    pattern = "BUILT_FEATURES"
+    name = "BUILT_FEATURES"
     ignore = true
index 7adfe31526889c22f0c1275379f2af5cd4921d2a..8d51430918b8d6239ca998d091eaa2adb7784518 100644 (file)
@@ -41,6 +41,18 @@ pub fn check_version(required_year: u32, required_release: u32) -> bool {
 //    unsafe { TODO: call ostree_sys:ostree_checksum_bytes_peek_validate() }
 //}
 
+pub fn checksum_from_bytes_v(csum_v: &glib::Variant) -> Option<GString> {
+    unsafe {
+        from_glib_full(ostree_sys::ostree_checksum_from_bytes_v(csum_v.to_glib_none().0))
+    }
+}
+
+pub fn checksum_to_bytes_v(checksum: &str) -> Option<glib::Variant> {
+    unsafe {
+        from_glib_full(ostree_sys::ostree_checksum_to_bytes_v(checksum.to_glib_none().0))
+    }
+}
+
 #[cfg(any(feature = "v2018_2", feature = "dox"))]
 pub fn commit_get_content_checksum(commit_variant: &glib::Variant) -> Option<GString> {
     unsafe {
index 7e37a713f91981342a1289b1124b0d5bf679c1e4..71dbb159be099406dfb0396ecb6f532e0b18c22e 100644 (file)
@@ -903,6 +903,14 @@ impl Repo {
         }
     }
 
+    pub fn write_content_trusted<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(&self, checksum: &str, object_input: &P, length: u64, cancellable: Option<&Q>) -> Result<(), glib::Error> {
+        unsafe {
+            let mut error = ptr::null_mut();
+            let _ = ostree_sys::ostree_repo_write_content_trusted(self.to_glib_none().0, checksum.to_glib_none().0, object_input.as_ref().to_glib_none().0, length, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
+            if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+        }
+    }
+
     pub fn write_dfd_to_mtree<P: IsA<MutableTree>, Q: IsA<gio::Cancellable>>(&self, dfd: i32, path: &str, mtree: &P, modifier: Option<&RepoCommitModifier>, cancellable: Option<&Q>) -> Result<(), glib::Error> {
         unsafe {
             let mut error = ptr::null_mut();
@@ -919,6 +927,22 @@ impl Repo {
         }
     }
 
+    pub fn write_metadata_stream_trusted<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(&self, objtype: ObjectType, checksum: &str, object_input: &P, length: u64, cancellable: Option<&Q>) -> Result<(), glib::Error> {
+        unsafe {
+            let mut error = ptr::null_mut();
+            let _ = ostree_sys::ostree_repo_write_metadata_stream_trusted(self.to_glib_none().0, objtype.to_glib(), checksum.to_glib_none().0, object_input.as_ref().to_glib_none().0, length, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
+            if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+        }
+    }
+
+    pub fn write_metadata_trusted<P: IsA<gio::Cancellable>>(&self, objtype: ObjectType, checksum: &str, variant: &glib::Variant, cancellable: Option<&P>) -> Result<(), glib::Error> {
+        unsafe {
+            let mut error = ptr::null_mut();
+            let _ = ostree_sys::ostree_repo_write_metadata_trusted(self.to_glib_none().0, objtype.to_glib(), checksum.to_glib_none().0, variant.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
+            if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+        }
+    }
+
     pub fn write_mtree<P: IsA<MutableTree>, Q: IsA<gio::Cancellable>>(&self, mtree: &P, cancellable: Option<&Q>) -> Result<gio::File, glib::Error> {
         unsafe {
             let mut out_file = ptr::null_mut();
index 518b4e22edd056958802b6966069fcba00ed909a..5ed5c39ffac81311978e43a95dd6e67ce4aaf32b 100644 (file)
@@ -1,2 +1,2 @@
 Generated by gir (https://github.com/gtk-rs/gir @ 2d1ffab1)
-from gir-files (https://github.com/gtk-rs/gir-files @ 26bb987)
+from gir-files (https://github.com/gtk-rs/gir-files @ ea146ce)
index 518b4e22edd056958802b6966069fcba00ed909a..5ed5c39ffac81311978e43a95dd6e67ce4aaf32b 100644 (file)
@@ -1,2 +1,2 @@
 Generated by gir (https://github.com/gtk-rs/gir @ 2d1ffab1)
-from gir-files (https://github.com/gtk-rs/gir-files @ 26bb987)
+from gir-files (https://github.com/gtk-rs/gir-files @ ea146ce)